using System;
using System.Collections.Generic;
using Speed.Data;
using SiteTest.Data;

namespace SiteTest.BL
{

    public partial class BL_Customers
    {

        public static long GetLastId(Database db)
        {
            return Max(db, "CustomerId");
        }

        public static void Save2(Database db, Customer rec, EnumSaveMode saveMode = EnumSaveMode.None)
        {
            if (rec.RecordStatus == RecordStatus.New)
                rec.DateCreated = DateTime.Now;
            Save(db, rec, saveMode);
        }

        public static List<Customer> FindByName(Database db, string customerName)
        {
            customerName = "%" + customerName + "%";
            return db.Select<Customer>("CustomerName like @CustomerName", new Parameter("CustomerName", customerName));
        }


    }

}
